UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r4QQNb190AqtK9UPLn01b5JZweGOa/G0Wy/zzBS6tcM=' 
WHERE 
  key_id = '2329e970e165944784636e5d29acea71ea768ab86c14283875fc5c5622d38243' 
  AND (
    token = 'r4QQNb190AqtK9UPLn01b5JZweGOa/G0Wy/zzBS6tcM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043