UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ok/A3UPLhAph+X3Rvj7j/9QyExDCIIzNHBx7leCYhjw=' 
WHERE 
  key_id = 'e046ecdabf2b0c79c559387722c8f19039bc434d019134a3acf6ee13c832a887' 
  AND (
    token = 'Ok/A3UPLhAph+X3Rvj7j/9QyExDCIIzNHBx7leCYhjw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024