UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ze2UewSibG6e/PChTKUM0U3/YJTiBtHDpXUktGDPJss=' 
WHERE 
  key_id = '2a3bc236eee4ec80ce2ef387bbe6d0b458861cc482053fc2976645f337171087' 
  AND (
    token = 'ze2UewSibG6e/PChTKUM0U3/YJTiBtHDpXUktGDPJss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028