UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'um/R5m577rYmmui4Wet4Hq0wQYhze2QzjDQQfg0Xw28=' 
WHERE 
  key_id = '32742512812992e406b75caee23cd3950a1aefd888379d74abbda0e89ace46cf' 
  AND (
    token = 'um/R5m577rYmmui4Wet4Hq0wQYhze2QzjDQQfg0Xw28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036