UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4ZLogJ399MjfNrgJlCN3adk2DpBDCukjmKFzytyuyWQ=' 
WHERE 
  key_id = '316129834d649bb09ad79ed56c074d59802ca0c45c65d2f3ed0a1f4479a6b328' 
  AND (
    token = '4ZLogJ399MjfNrgJlCN3adk2DpBDCukjmKFzytyuyWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043