UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'siIGWUWv4ti8XDWNJ2t3X0FIx0/7jzNeGk38NLBk8ms=' 
WHERE 
  key_id = '26ebbcc58fa09dfda729468482c990dd24914bf3113936e0cd7c591a3e52b862' 
  AND (
    token = 'siIGWUWv4ti8XDWNJ2t3X0FIx0/7jzNeGk38NLBk8ms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030