UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jNiqjqV/wSsoc3xIbzKsP93Kc05znESQldiTaQ149KM=' 
WHERE 
  key_id = '52bcb07f183a111976ccf69a487fcf225f4f96a9ea440c28ab57a8c3c652fed1' 
  AND (
    token = 'jNiqjqV/wSsoc3xIbzKsP93Kc05znESQldiTaQ149KM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024