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

Query time 0.00032