UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QcpSxnJ29KAmpzl+Go56IaMy+vOHLL+GPnnqEBhLuOk=' 
WHERE 
  key_id = '1dce8f90e0d5371655384fc542dbc9b969fb93ced576f2bbfa6d6bd55ceb1751' 
  AND (
    token = 'QcpSxnJ29KAmpzl+Go56IaMy+vOHLL+GPnnqEBhLuOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031