UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qiDod4H5hd6ARwgp7/1uq8sERImQEhJrPvsn18cjzig=' 
WHERE 
  key_id = '1695f47277f07df5eef42182873cd9729dfb8258d0444f0d76660f34a1334f27' 
  AND (
    token = 'qiDod4H5hd6ARwgp7/1uq8sERImQEhJrPvsn18cjzig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00112