UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NkaqTYVL/zxFveaSGlJl7z2wP/tK4B3iugn8kPCRHwE=' 
WHERE 
  key_id = '4e9971b5cdfa0d69320c2004f978f5046981b49ad3f2b37b3646c3d88ce63cb9' 
  AND (
    token = 'NkaqTYVL/zxFveaSGlJl7z2wP/tK4B3iugn8kPCRHwE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048