UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A43VHrZ1jCaifaLVS+T5ZCofA1hhsrIMviJfxe4hN6g=' 
WHERE 
  key_id = 'd471260e42ed74f968d71ce842fe6840eabb4f4f346894b9e4c1cc039c785c07' 
  AND (
    token = 'A43VHrZ1jCaifaLVS+T5ZCofA1hhsrIMviJfxe4hN6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040