UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iN1HVbRC1hJdfaTRy3/xSXnaLptybqPk2Epxn6KLH+0=' 
WHERE 
  key_id = '5903bbbc0e39fe0f8b80ebe7982beac21592aabcddaec0d249ab58a1b7e409a8' 
  AND (
    token = 'iN1HVbRC1hJdfaTRy3/xSXnaLptybqPk2Epxn6KLH+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052