UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eEILYi7FyMm4UpxnJtgVULshckw3QMPlpJknekVN4Pw=' 
WHERE 
  key_id = '5a12792d6322c3fd2661de9da1b07e98a7be588485903ca4d22f584072ffa28d' 
  AND (
    token = 'eEILYi7FyMm4UpxnJtgVULshckw3QMPlpJknekVN4Pw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044