UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gWst7eRF1sQU1A3kVJmuR/iBjgqzR+gzoWkgiZ89t5w=' 
WHERE 
  key_id = '593ded940e3f7c3486721c8f7fa56247aebfc1a09e8b50bf649cdba6a05b82c3' 
  AND (
    token = 'gWst7eRF1sQU1A3kVJmuR/iBjgqzR+gzoWkgiZ89t5w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054