UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ioysj+L/9LO1GcfNL3FSg8nLB0mBcKK5nzXpwfe/dTY=' 
WHERE 
  key_id = '5686c267e9687781d487c10a4aa8f49943d65bac855de6812a349bf8de101363' 
  AND (
    token = 'ioysj+L/9LO1GcfNL3FSg8nLB0mBcKK5nzXpwfe/dTY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031