UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd3SP0hthMhUVFh/3ErriJ7CDb71gb3tOgubeZPQT/n8=' 
WHERE 
  key_id = '027f187a25e20329a96b49cdb7d82b9b9188e84245b52623f3527134153ef1c7' 
  AND (
    token = 'd3SP0hthMhUVFh/3ErriJ7CDb71gb3tOgubeZPQT/n8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045