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

Query time 0.00033