UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4iMNxcejQgyardwRyat0E8QGHt1W1om3q7Bvmlxswhs=' 
WHERE 
  key_id = 'dd28a56c9b67174535e95e8f79f426d796b9ea82f1f06706af60cdf4a6d3e24a' 
  AND (
    token = '4iMNxcejQgyardwRyat0E8QGHt1W1om3q7Bvmlxswhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026