UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O4mocOBJYNA0aspDuJV6rpC4rxjqD0MCoDOwhDZmbDo=' 
WHERE 
  key_id = '0fc0591af1eb39e38e3916667a93df6c4c458f9a2dca5dc618d469911a5ad998' 
  AND (
    token = 'O4mocOBJYNA0aspDuJV6rpC4rxjqD0MCoDOwhDZmbDo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028