UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mTqyeDUyOpUQeRmtuhz9d3/kulLxeqcM69eE7JLwz84=' 
WHERE 
  key_id = '54b5ef4562081ace8104b573dc3c85961da971908d135821c29723073f451b92' 
  AND (
    token = 'mTqyeDUyOpUQeRmtuhz9d3/kulLxeqcM69eE7JLwz84=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059