UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uhTEeFI8QxgKlieoP6GTVQPKn5sCXs6PWE50MGU2lhw=' 
WHERE 
  key_id = '08a7d7355d744cd5d285cee9fd247b276d6206e865ab167649315ba60ec3b43e' 
  AND (
    token = 'uhTEeFI8QxgKlieoP6GTVQPKn5sCXs6PWE50MGU2lhw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026