UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XE8+0ksLeLcBfcZwwvTeof/BXCmbo8wFISqdixYANWc=' 
WHERE 
  key_id = 'dc99fc495db86802e8cd8644ca993522f5e5ec941f2de839c83a7e69d6c4fe4d' 
  AND (
    token = 'XE8+0ksLeLcBfcZwwvTeof/BXCmbo8wFISqdixYANWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024