UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mmgKEwHxHIEUfWVKabgxeM2oSpUQ4S/22AuxmOl07Uw=' 
WHERE 
  key_id = 'c38a9b4f3c44a1ffd5c7b76edcee72e6964e768a5952c73feb0b7d63931df5d1' 
  AND (
    token = 'mmgKEwHxHIEUfWVKabgxeM2oSpUQ4S/22AuxmOl07Uw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041