UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nHETHENufL5Nxz50UdqplStcEy+UKhct4wDDERs1oew=' 
WHERE 
  key_id = '245421ea7ae58d3453e93dfd797f4ddde090f84a7395650505f132a123afe2ae' 
  AND (
    token = 'nHETHENufL5Nxz50UdqplStcEy+UKhct4wDDERs1oew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033