UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XQS10uk+4Clbi9Wdp9kpvANlQs02otQB2c3Yx1S4Ldg=' 
WHERE 
  key_id = '9834978ff1ed02d69d1a7f52544e76a79a1bde37e4ba46fb8352854d53574a71' 
  AND (
    token = 'XQS10uk+4Clbi9Wdp9kpvANlQs02otQB2c3Yx1S4Ldg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027