UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8mTAlCABWwm+YYyk5eCRW9tcMDUazuZsePxq7+8E4nM=' 
WHERE 
  key_id = 'b8678e680bd16a27f0baa3b116e8fd39b0c7a431cb9cbc982216c314d8bc20be' 
  AND (
    token = '8mTAlCABWwm+YYyk5eCRW9tcMDUazuZsePxq7+8E4nM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026