UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VBMH2gGqtq5XwwPYGWeGXzAUuPCQFTNaW1lH+c5Smhk=' 
WHERE 
  key_id = '34779f716e542e55d1199432cfe8df4a9d4d6ed49122f71109aaa8de33069f6a' 
  AND (
    token = 'VBMH2gGqtq5XwwPYGWeGXzAUuPCQFTNaW1lH+c5Smhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050