UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K/G2rgTS5QbBvFCZIabThG1BZz/bMdCKbrUOXSjSfUE=' 
WHERE 
  key_id = '987fc7c7ab98e651ed7cb3fd1b424db4bba694d42afbb649b5390375bb48a3e5' 
  AND (
    token = 'K/G2rgTS5QbBvFCZIabThG1BZz/bMdCKbrUOXSjSfUE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037