UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p8zsGPEJ5Enzm0SSp1hGnSM/UUDAp2sRjcPszCBYLPE=' 
WHERE 
  key_id = '7b2a0d8bd770eba1c55a0e48ea37c92ad0655ddc975097e0e4d3b0a7cc288230' 
  AND (
    token = 'p8zsGPEJ5Enzm0SSp1hGnSM/UUDAp2sRjcPszCBYLPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048