UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hqewM41j2h2ZTDzOvmB2FD4ozZSJTWJP0KfYReGPvLs=' 
WHERE 
  key_id = '616d24c86693e6967c1bb3ac5171097945bf026e7df73ed42b35d940d57bcd27' 
  AND (
    token = 'hqewM41j2h2ZTDzOvmB2FD4ozZSJTWJP0KfYReGPvLs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043