UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7zTTjYvy1ZXWoU+VewdmOo89NDFVOhzedNdRUza9Y9Q=' 
WHERE 
  key_id = 'a15fc9187dc266f0e5ec8531016d1216729cbaff9c38e7b4c36f41d4d5644961' 
  AND (
    token = '7zTTjYvy1ZXWoU+VewdmOo89NDFVOhzedNdRUza9Y9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070