UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q+pnoZ1cTArInEZg6NaNZMd9NLX7twpK0fdRZJifUyc=' 
WHERE 
  key_id = '7bba242b8b3eab4892031433c97b6f4fcf7b6066cf66d268993cedf9bb0255a7' 
  AND (
    token = 'Q+pnoZ1cTArInEZg6NaNZMd9NLX7twpK0fdRZJifUyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031