UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dIpxRNnKIYihV109LCwWZDGTih03IZbd5c3TwK1td/w=' 
WHERE 
  key_id = '9142ea18ef63237db3a34cfed0402b2900de7351230780197792e0021481852f' 
  AND (
    token = 'dIpxRNnKIYihV109LCwWZDGTih03IZbd5c3TwK1td/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050