UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'td/O14bnWynmTi+O/MCZKhoiAVnHwXqTXCC81nhWHiw=' 
WHERE 
  key_id = '1b0826b1de1d3b46656588de4b9d25445ab779f0d9a0a9b299c38c3141dafd2c' 
  AND (
    token = 'td/O14bnWynmTi+O/MCZKhoiAVnHwXqTXCC81nhWHiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030