UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fHGzd2j7EO+tpYIpgot5LNQ2RkC4G7jotN3FmqWP1Tk=' 
WHERE 
  key_id = '24b20c795f8c2af997e8147228f1da44d372e27a34a94824918df3a1a7bff9cf' 
  AND (
    token = 'fHGzd2j7EO+tpYIpgot5LNQ2RkC4G7jotN3FmqWP1Tk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024